#ifndef QUICKGUISHEET_H
#define QUICKGUISHEET_H

#include "OgreException.h"

#include "QuickGUIForwardDeclarations.h"
#include "QuickGUIPanel.h"
#include "QuickGUIWindow.h"

namespace QuickGUI
{
	/** Represents a transparent area for holding widgets.
		@remarks
		The Sheet class is derived from a Window, although it
		differs because it is the size of the screen.
		In addition, the Sheet class can create Windows.
	*/
	class _QuickGUIExport Sheet :
		public Panel
	{
	public:
		friend class GUIManager;
	public:
		/** Create a Window with material, borders, and TitleBar
            @param
                dimensions The relative x Position, y Position, width, and height of the window.
			@param
                material Ogre material to define the Window image.
			@param
				toggle visibility.
			@note
				Name for window will be autogenerated. (Convenience method)
        */
		Window* createWindow();
		Window* createWindow(const std::string& name);

		virtual Widget* getTargetWidget(const Point& pixelPosition);
		virtual const Widget* getTargetWidget(const Point& pixelPosition) const;
		Window* getWindow(const std::string& name);

		virtual bool overTransparentPixel(const Point& mousePixelPosition) const;

		/**
		* Properly cleans up all child widgets.
		*/
		virtual void removeAndDestroyAllChildWidgets();

		/**
		* Applies the texture to the Quad if exists in some form, and updates the Image used for
		* transparency picking.
		*/
		virtual void setMaterial(const std::string& textureName);

		virtual void setSkin(const std::string& skinName, bool recursive = false);

	protected:
		/** Constructor
            @param
                name The name to be given to the widget (must be unique).
			@note
				If you want a transparent background, pass "" as the material.
        */
		Sheet(const std::string& name, Size initialSize, const std::string &skinName, GUIManager* gm);
		virtual ~Sheet();

		virtual void setHeight(float pixelHeight);

		virtual void setQuadContainer(QuadContainer* container);

		/**
		* Manually set size of widget.
		*/
		virtual void setSize(const float& pixelWidth, const float& pixelHeight);
		virtual void setSize(const Size& pixelSize);
		virtual void setWidth(float pixelWidth);

		std::string mMaterialName;
	};
}

#endif
